home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.mactech.com 2010
/
ftp.mactech.com.tar
/
ftp.mactech.com
/
machack
/
Hacks96
/
RoasterJavaWAHTTPCGI.sit
/
Roaster-Java-WA-HTTP-CGI hack
/
JavaWebStuff
/
JavaWebStuff.c
< prev
next >
Wrap
C/C++ Source or Header
|
1996-06-22
|
1KB
|
68 lines
#include <stdio.h>
#include <string.h>
#include <sioux.h>
#include "JavaRuntime.h"
#include "Messages.h"
long gRunning = 0;
void main()
{
OSErr status;
char *foo;
JavaRuntime rt;
JavaEnv env;
JavaRef argvRef;
EventRecord theEvent;
char *argv = "80";
SIOUXSettings.standalone = FALSE;
SIOUXSettings.setupmenus = TRUE;
printf("Java Web Server Starting...\n");
status = SetupQueues();
if (status != noErr)
{
printf("Error setting up queues -- %d\n", status);
return;
}
FlushQ(SERVERQ);
FlushQ(CGIQ);
rt = GetJavaRuntime();
gRunning = 1;
env = JavaEnv_make(rt, NULL);
if (env == NULL)
{
gRunning = 0;
printf("Can't make a java env!\n");
}
//status = JavaArray_makeUTF(env, &argvRef, "[Ljava/lang/String;", 0);
JavaObject_forkUTF(env, NULL, "wa/http/TinyHTTPd", 1, &argv);
/*
status = JavaObject_callStaticUTF(env, NULL, "wa/http/TinyHTTPd", "main",
"([Ljava/lang/String;)V", argvRef);
*/
printf("Startup message %d\n", status);
while (gRunning)
{
JavaRuntime_yield(10);
if ( WaitNextEvent(everyEvent, &theEvent, 1, NULL))
SIOUXHandleOneEvent(&theEvent);
}
DisposeJavaRuntime();
}